<template>
	<view class="big-box flex-col align-center">
		<top-navigation bgColor='#FFFFFF00' :isBack="true" :custom="true" nextUrl="/pages/index/index?PageCur=3">
			<!-- <text slot='center-slot' class="center-slot"></text> -->
			<view slot='right-slot' class="center-slot" @tap="$navto('/pages/mine/myOre/oreLog')">
				记录
			</view>
		</top-navigation>
		<u-toast ref="uToast"></u-toast>
		<view class="top-box">
			<!-- <image class="long-baby" src="/static/images/mine/long-baby.png" mode=""></image> -->
			<view class="my-qing-long">
				我的钻石<text class="unit">(个)</text>
			</view>
			<view class="long-num">
				<!-- {{oreInfo.crystal}} -->
				<u-count-to :startVal="0"
				:decimals="6"
				color='#27ff92'
				fontSize='72rpx'
				:endVal="oreInfo.crystal"></u-count-to>
				<!-- <image @tap="$navto('/pages/star-map/crystalRanking')" class="sjb" src="/static/images/starmap/sjb-r3.png" mode=""></image> -->
			</view>
			<view class="go-give"  @tap="goGive">
				去赠送
			</view>
			<view class="">
				<image class="my-ore-tips" :src="userInfo.crystal_page_bg" mode="widthFix"></image>
			</view>
		</view>



		<!-- 联系客服弹出层-->
		<u-popup :show="moneyShow" mode="center" @close="moneyShow=false" round="16rpx" bgColor='transparent'
			overlayOpacity='0.7'>
			<view class="popup-one-box flex-col align-center">
				<view class="has-shuijing justify-center">
					系统提示
				</view>
				<view class="has-shuijing-desc justify-center">
					实名认证后即可使用本功能
				</view>
				<view class=" justify-between">
					<view class="popup-box-btn align-center justify-center" @click="moneyShow=false">
						取消
					</view>
					<view class="popup-box-btn-1 align-center justify-center" @click="$navto('/pages/mine/appCenter/userRealName?type=myOre')">
						去实名
					</view>
				</view>
				
				
			</view>
		</u-popup>
		<u-popup :show="passShow" mode="center" @close="passShow=false" round="16rpx" bgColor='transparent'
			overlayOpacity='0.7'>
			<view class="popup-one-box flex-col align-center">
				<view class="has-shuijing justify-center">
					系统提示
				</view>
				<view class="has-shuijing-desc justify-center">
					设置密码后即可使用本功能
				</view>
				<view class=" justify-between">
					<view class="popup-box-btn align-center justify-center" @click="passShow=false">
						取消
					</view>
					<view class="popup-box-btn-1 align-center justify-center" @click="$navto('/pages/mine/setting/payPass/payPass?type=myOre')">
						去设置
					</view>
				</view>
				
				
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				current: 0,
				moneyShow: false,
				passShow: false,
				oreInfo:{},
				userInfo:{},
				pageurl:'/pages/mine/myOre/myOre'

			}
		},
		onShow() {
			this.getCardInfo()
			this.getuserInfo()
		},
		methods: {
			async getCardInfo() {
				let url = '/api/v1/crystal_transfer'
				let {
					code,
					msg,
					data
				} = await this.$getRequest(url)
				if (code == 200) {
					console.log(data, '静态资源');
					this.oreInfo = data
				} else {
					this.$refs.uToast.show({
						message: msg
					})
				}
			},
			async getuserInfo() {
				let url = '/api/v1/my'
				let {
					code,
					msg,
					data
				} = await this.$getRequest(url)
				if (code == 200) {
					console.log(data, '静态资源');
					uni.setStorageSync('userInfo', data[0])
					this.userInfo = data[0]
				} else {
					this.$refs.uToast.show({
						message: msg
					})
				}
			},
			goGive(){
				console.log("uni.getStorageSync('userInfo').auth",uni.getStorageSync('userInfo'));
				// 去赠送
				// 需要修改bs
				if(uni.getStorageSync('userInfo').auth == 0){
					// 没有实名认证需要弹窗
					this.moneyShow = true
				}else if(uni.getStorageSync('userInfo').is_pay_password == 0){
					this.passShow = true
				}else{
					this.$navto('/pages/mine/myOre/oreGive')
				}
			},
			// 应用中心
			getCategory(value) {
				switch (value) {
					case 0:
						// 邀请好友
						this.$navto('/pages/mine/appCenter/inviteFriends')
						break;
					default:
						break;
				}
			},
			myCopy(value) {
				let _this = this
				//提示模板
				uni.setClipboardData({
					data: value, //要被复制的内容
					showToast: false,
					success: () => { //复制成功的回调函数
						_this.$refs.uToast.show({
							message: '已复制',
							type: 'default',
							duration: '500'

						})
						// uni.showToast({ //提示
						// 	title: wxorqq == 'w' ? "微信号已复制" : 'QQ号已复制'
						// })
					}
				});
			},
			bannerTap() {
				// banner点击
			},
			bannerChange() {
				// banner改变
			},
			featureTap(e) {
				this.moneyShow = true
			}
		}
	}
</script>
<style>
	@import '/common/css/common.css';
</style>
<style lang="scss" scoped>
	.big-box {
		min-height: 100vh;
		background: url('/static/images/mine/my_bg.png') #16161e no-repeat top center / 100% 668rpx;
		// padding: 0 32rpx 60rpx;

		.center-slot {
			color: #FFF;
			font-size: 26rpx;

		}

	}


	.popup-one-box {
		position: relative;
		z-index: 7;
		width: 560rpx;
		border-radius: 16rpx;
		background: #1D1D1D;
		padding: 48rpx 40rpx;
	
		.has-shuijing {
			width: 100%;
			height: 44rpx;
			font-size: 32rpx;
			color: #FFFFFF;
			margin-bottom: 24rpx;
		}
		.has-shuijing-desc {
			color: rgba(255,255,255,.6);
			    font-size: .75rem;
			    line-height: 1.125rem;
				margin-bottom: 48rpx;
		}
	
		.shui-ji-num {
			font-size: 28rpx;
			color: #FFF;
			font-weight: 700;
		}
	
		.popup-box-btn {
			width: 227rpx;
			height: 72rpx;
			background: #252727;
			    color: rgba(255,255,255,.4);
			font-size: 28rpx;
			border-radius: 8rpx;
		}
		.popup-box-btn-1 {
			width: 227rpx;
			height: 72rpx;
			background: #27FF92;
			    color: #000;
			font-size: 28rpx;
			margin-left: 24rpx;
			border-radius: 8rpx;
		}
	
		
	
	
		.popup-kuangshi {
			width: 56rpx;
			height: 36rpx;
		}
	
	
	
		
	
		
	
	}

	.top-box {
		width: 100%;
		position: relative;
		margin: 0rpx auto 26rpx;
		padding: 34rpx 44rpx;
		border-radius: 16rpx;

		.my-ore-tips {
			margin-top: 120rpx;
			width: 100%;
		}

		.long-baby {
			position: absolute;
			bottom: 0;
			right: 0;
			width: 232rpx;
			height: 232rpx;
		}

		.my-qing-long {
			color: #FFFFFF99;
			font-size: 24rpx;
		}

		.go-give {
			margin-top: 46rpx;
			font-size: .875rem;
			color: #000;
			text-align: center;
			width: 7.5rem;
			height: 2.25rem;
			line-height: 2.25rem;
			font-weight: 700;
			border-radius: .25rem;
			background: linear-gradient(122deg, #2ad9e9 0%, #f4c0fa 61%, #ede9b4 100%);
		}

		.long-num {
			margin-top: 24rpx;
			font-size: 72rpx;
			color: #27ff92;
			position: relative;
			.sjb{
				position: absolute;
				width: 90rpx;
				height: 90rpx;
				right: 0;
				top: 0;
			}

			.unit {
				margin-left: 15rpx;
				font-size: 24rpx;
				color: #FFFFFF99;
			}
		}
	}
</style>